package com.networkmmc.demo.sql;

import java.util.ArrayList;
import java.util.List;

public class SqlObj {

    private String tableName;

    private String sql;

    private List<String> fields = new ArrayList<>();

    private List<Object> values = new ArrayList<>();

    private List<Object> fieldsPlaceholder = new ArrayList<>();

    private List<String> conditionFields = new ArrayList<>();

    private List<Object> conditionValues = new ArrayList<>();

    private List<String> conditionPlaceholder = new ArrayList<>();

    private String key_;

    public List<Object> getFieldsPlaceholder() {
        return fieldsPlaceholder;
    }

    public void setFieldsPlaceholder(List<Object> fieldsPlaceholder) {
        this.fieldsPlaceholder = fieldsPlaceholder;
    }

    public List<String> getConditionPlaceholder() {
        return conditionPlaceholder;
    }

    public void setConditionPlaceholder(List<String> conditionPlaceholder) {
        this.conditionPlaceholder = conditionPlaceholder;
    }

    public SqlObj(String tableName) {
        this.tableName = tableName;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getSql() {
        return sql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public List<String> getFields() {
        return fields;
    }

    public void setFields(List<String> fields) {
        this.fields = fields;
    }

    public List<Object> getValues() {
        return values;
    }

    public void setValues(List<Object> values) {
        this.values = values;
    }

    public List<String> getConditionFields() {
        return conditionFields;
    }

    public void setConditionFields(List<String> conditionFields) {
        this.conditionFields = conditionFields;
    }

    public List<Object> getConditionValues() {
        return conditionValues;
    }

    public void setConditionValues(List<Object> conditionValues) {
        this.conditionValues = conditionValues;
    }

    public String getKey_() {
        return key_;
    }

    public void setKey_(String key_) {
        this.key_ = key_;
    }

    public SqlObj addFields(String field, Object value){
        fields.add(fields.size(), field);
        values.add(values.size(), value);
        fieldsPlaceholder.add(Contants.PLACEHOLDER);
        return this;
    }

    public SqlObj addConditions(String condition, Object value){
        conditionFields.add(conditionFields.size(), condition);
        conditionValues.add(conditionValues.size(), value);
        conditionPlaceholder.add(Contants.PLACEHOLDER);
        return this;
    }

}
